package com.example.stars_project_android.index;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ListView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import com.example.stars_project_android.R;
import com.example.stars_project_android.adapter.MessageAdapter;
import com.example.stars_project_android.adapter.MyRoomAdapter;
import com.example.stars_project_android.entity.RoomAppearance;
import com.example.stars_project_android.entity.SelfMessage;

import java.util.ArrayList;
import java.util.List;

public class SelfMessages extends AppCompatActivity {
    private Context mContext;
    private ListView listView;
    private BaseAdapter mAdapter = null;
    private List<SelfMessage> mData = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_messages);


        mContext = SelfMessages.this;
//        listView = findViewById(R.id.lv_message);

        mData = new ArrayList<>();
        SelfMessage selfMessage = new SelfMessage();
        selfMessage.setFirendId("gowest");
        selfMessage.setMessage("bhshih");
        mData.add(selfMessage);


        mAdapter = new MessageAdapter(this, R.layout.message_item, mData);

        listView.setAdapter(mAdapter);

        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                // `content` 为要发送的文本内容，`toChatUsername` 为对方的账号。
                //EMMessage message = EMMessage.createTxtSendMessage(content, toChatUsername);
                // 发送消息
                //EMClient.getInstance().chatManager().sendMessage(message);

            }
        });


    }
}
